import { InjectionKey } from "vue";
import { createStore, Store } from "vuex";

import modules from "./modules";

// https://vuex.vuejs.org/zh/guide/typescript-support.html

// 为 store state 声明类型
export interface State {
  user: {
    name: string;
    age: number;
  };
}

// 定义 injection key
export const key: InjectionKey<Store<State>> = Symbol();

export default createStore<State>({
  modules,
});
